from PIL import Image

tileArray = [ [ [0, 0] ] ]

#print tileArray[1][1][0]

width = 128
height = 128
tileSize = 32
outputFileName = "map.png"

tiles = Image.open('beachTiles.png')
tilePix = tiles.load()
tileMap = Image.new("RGBA", (width * tileSize, height * tileSize), "pink")
mapPix = tileMap.load()

    #sandTile = tiles.getData()

for x in range(width):
    for y in range(height):
        for i in range(tileSize):
            for j in range(tileSize):
                mapPix[x * tileSize + i, y * tileSize + j] = tilePix[i + tileSize * 0, j + tileSize * 0]
    print "%02d" % (x / float(width) * 100) + "%"

print "Saving..."
tileMap.save(outputFileName)
print "Image saved as " + outputFileName
